// This file replicates Figure A1


clear
// Download the Republican Committee Requests data
use SenateRepublicanCommitteeRequests.dta


**************
** Figure A1 **
**************

// Generate an indicator variable for being a Freshman
gen Freshman = 1 if chambsen == 1
replace Freshman = 0 if chambsen != 1

// Counts number of Constituency Committees Requested in 1st Request
// Note Constituency committees are 1) Small Business, 2) Veterans Affairs, 3) Agriculture 4) Armed Services, 5) Energy

gen ConstituencyReq1 = 1 if commreq1 == "Small Business" | commreq1 == "Veterans Affairs" | commreq1 == "Agriculture" | commreq1 == "Armed Services" | commreq1 == "Energy"

// Counts number of Policy Committees Requested in 1st Request
// Note Policy committees are 1) Banking, Housing, and Urban Affairs, 2) Commerce, Science and Transportation, 3) Environment and Public Works, 4) Finance, 5) Foreign Relations, 6) Government Affairs, 7) Judiciary, 8) Labor and Human Resources

bysort Freshman: summarize ConstituencyReq1

gen PolicyReq1 = 1 if commreq1 == "Banking" | commreq1 == "Commerce" | commreq1 == "Environment" | commreq1 == "Finance" | commreq1 == "Foreign Relations" | commreq1 == "Government Affairs" | commreq1 == "Judiciary" | commreq1 == "Labor"

bysort Freshman: summarize PolicyReq1


// Counts number of Prestige Committees Requested in 1st Request
// Note Constituency committees are 1) Appropriations, 2) Budget, 3) Rules and Administration

gen PrestigeReq1 = 1 if commreq1 == "Appropriations" | commreq1 == "Budget" | commreq1 == "Rules"

bysort Freshman: summarize PrestigeReq1


// Counts number of Admin Committees Requested in 1st Request
// Note Constituency committees are 1) District of Columbia, 2) Post Office
gen AdminReq1 = 1 if commreq1 == "District of Columbia" | commreq1 == "Post Office" 

bysort Freshman: summarize AdminReq1



// Now we can create a pie-chart for the category of committee requested as first choice by Freshman
* Calculate sums for the subset where Freshman == 1
summarize PrestigeReq1 if Freshman == 1
gen sum_prestige_f = r(sum)

summarize ConstituencyReq1 if Freshman == 1
gen sum_constituency_f = r(sum)

summarize AdminReq1 if Freshman == 1
gen sum_admin_f = r(sum)

summarize PolicyReq1 if Freshman == 1
gen sum_policy_f = r(sum)


graph pie sum_prestige_f sum_constituency_f sum_admin_f sum_policy_f

* Save graph of Figure A1 for Freshmen
graph save FigureA1_Freshmen

scalar Freshman_Prestige_Req1 = sum_prestige_f /(sum_prestige_f + sum_constituency_f + sum_admin_f + sum_policy_f)
display Freshman_Prestige_Req1


scalar Freshman_Admin_Req1 = sum_admin_f /(sum_prestige_f + sum_constituency_f + sum_admin_f + sum_policy_f)
display Freshman_Admin_Req1


scalar Freshman_Constituency_Req1 = sum_constituency_f /(sum_prestige_f + sum_constituency_f + sum_admin_f + sum_policy_f)
display  Freshman_Constituency_Req1 


scalar Freshman_Policy_Req1 = sum_policy_f /(sum_prestige_f + sum_constituency_f + sum_admin_f + sum_policy_f)
display Freshman_Policy_Req1



// Now we can create a pie-chart for the category of committee requested as first choice by Non-Freshman
* Calculate sums for the subset where Freshman == 0
summarize PrestigeReq1 if Freshman == 0
gen sum_prestige_nf = r(sum)

summarize ConstituencyReq1 if Freshman == 0
gen sum_constituency_nf = r(sum)

summarize AdminReq1 if Freshman == 0
gen sum_admin_nf = r(sum)

summarize PolicyReq1 if Freshman == 0
gen sum_policy_nf = r(sum)


graph pie sum_prestige_nf sum_constituency_nf sum_admin_nf sum_policy_nf

* Save graph of Figure A1 for NonFreshmen
graph save FigureA1_NonFreshmen

scalar NonFreshman_Prestige_Req1 = sum_prestige_nf /(sum_prestige_nf + sum_constituency_nf + sum_admin_nf + sum_policy_nf)
display NonFreshman_Prestige_Req1


scalar NonFreshman_Admin_Req1 = sum_admin_nf /(sum_prestige_nf + sum_constituency_nf + sum_admin_nf + sum_policy_nf)
display NonFreshman_Admin_Req1


scalar NonFreshman_Constituency_Req1 = sum_constituency_nf /(sum_prestige_nf + sum_constituency_nf + sum_admin_nf + sum_policy_nf)
display  NonFreshman_Constituency_Req1 


scalar NonFreshman_Policy_Req1 = sum_policy_nf /(sum_prestige_nf + sum_constituency_nf + sum_admin_nf + sum_policy_nf)
display NonFreshman_Policy_Req1
